﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;

namespace LuZhouLaoJiao
{
    public partial class InputBatchDetails : Form
    {
        public InputBatchDetails()
        {
            InitializeComponent();
        }
        string picihao;
        private void InputBatchDetails_Load(object sender, EventArgs e)
        {
            picihao = string.Format("{0:yyyyMMddHHmmssff}", DateTime.Now);
            tbBatchNum.Text = picihao;
            tbBatchNum.ReadOnly = true;

            tbUser.Text = Global.userName;
            tbUser.ReadOnly = true;
            //MessageBox.Show(picihao);
        }

        private void btnFinish_Click(object sender, EventArgs e)
        {
            Global.jiaochihao = tbJiaoChiNum.Text.ToString().Trim();
            BatchInfo batchinfo = (BatchInfo)this.Owner;
            DataRow dr = batchinfo.dt.NewRow();

            dr["批次号"] = picihao;
            dr["检测人"] = tbUser.Text;
            dr["样本来源"] = tbSampleFrom.Text;
            dr["检测日期"] = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
            dr["检测时间"] = string.Format("{0:HH:mm:ss}", DateTime.Now);
            dr["备注"] = tbRemark.Text;
            dr["已提交"] = "";
            batchinfo.isAddRow = true;
            batchinfo.dt.Rows.Add(dr);
            //batchinfo.LoadData(0, 0);
            //MessageBox.Show("添加新行");
            
            this.Close();
            //batchinfo.dataGridView1.Rows.Add(dr);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
